﻿namespace Engine.Serialization
{
    using System.IO;
    using System.Xml.Serialization;

    public class XmlSerializerAdapter<T> : ISerializer<T>
        where T : class
    {
        #region [Attributes]
        private XmlSerializer serializer;
        #endregion

        #region [Methods]
        public XmlSerializerAdapter()
        {
            this.serializer = new XmlSerializer(typeof(T));
        }

        public T Deserialize(string input)
        {
            return (T)this.serializer.Deserialize(new StringReader(input));
        }
        #endregion
    }
}
